package cn.cosmosx.service.sys.impl;

import cn.cosmosx.entity.sys.SysUser;
import cn.cosmosx.entity.vo.RolePermsVO;
import cn.cosmosx.entity.vo.UserVO;
import cn.cosmosx.mapper.sys.SysUserMapper;
import cn.cosmosx.mapper.sys.UserRelationshipsMapper;
import cn.cosmosx.service.sys.SysUserService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 用户表 服务实现类
 * </p>
 *
 * @author gengzhy
 * @since 2022-10-02 23:52:28
 */
@Service
public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> implements SysUserService {
    @Autowired
    private UserRelationshipsMapper userRelationshipsMapper;
    /**
     * 查询用户详细信息
     *
     * @param userId   - 用户id
     * @param username - 用户名
     * @return - UserVO
     */
    @Override
    public UserVO getRolesAndPermsById(Long userId, String username) {
        return userRelationshipsMapper.getRolesAndPermsById(userId, username);
    }

    /**
     * 角色权限对应关系列表
     *
     * @return - RolePermsVO
     */
    @Override
    public List<RolePermsVO> listRolePerms() {
        return userRelationshipsMapper.listRolePerms();
    }

}
